package dgut.party.business.dto.vo;

import dgut.party.business.entity.base.Account;
import dgut.party.business.entity.user.AdminUser;
import dgut.party.business.entity.user.NormalUser;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.springframework.beans.BeanUtils;

@Getter
@Setter
@SuperBuilder
public class UserBriefVo {

  public UserBriefVo(Account account) {
    BeanUtils.copyProperties(account, this);
    if (account instanceof AdminUser) {
      this.title = "管理员";
    } else {
      this.title = ((NormalUser) account).getUserTitle().getName();
    }
  }

  private String username;
  private String realName;
  private String title;
  private String avatar;
}
